package com.j.lemon.learn.onlytest;

/**
 * @Author lijunjun
 * @Date 2019-12-03 14:18
 * @Description
 */
public class Test3 {
    Test3(){
        System.out.println("test3 init");
    }

    {
        System.out.println("test3 common");
    }
    static {
        System.out.println("test3 static");
    }
    public void a(){
        System.out.println("test3");
    }
}

class B extends Test3{
    B(){
        System.out.println("b init");
    }
    static {
        System.out.println("b static");
    }
    {
        System.out.println("b common");
    }

    public void a(){
        System.out.println("b");
    }
}

class C{
    public static void main(String[] args) {
//        Test3 t = new Test3();
//        t.a();
        B b = new B();
//        b.a();

    }
}

class Foo {
    int i = 1;

    Foo() {
        System.out.println(i);
        int x = getValue();
        System.out.println(x);
    }

    {
        i = 2;
    }

    protected int getValue() {
        return i;
    }
}

//子类
class Bar extends Foo {
    int j = 1;

    Bar() {
        j = 2;
    }

    {
        j = 3;
    }

    @Override
    protected int getValue() {
        return j;
    }

    public static void main(String[] args) {
        Bar bar = new Bar();
        System.out.println(bar.getValue());
    }
}

class MyClassLoder extends ClassLoader{

}
